﻿import os
import sys

# 强制设置 ImageMagick 路径
os.environ['IMAGEMAGICK_BINARY'] = r'D:\apps\ImageMagick-7.1.2-Q16-HDRI\magick.exe'

print(" 强制设置 ImageMagick 路径")

# 重新导入 moviepy 确保使用新配置
import importlib
import moviepy.config
importlib.reload(moviepy.config)

print(f"当前 ImageMagick 路径: {moviepy.config.IMAGEMAGICK_BINARY}")

# 测试 TextClip
from moviepy.video.VideoClip import TextClip
try:
    txt = TextClip("测试", fontsize=24, color='white')
    print(" TextClip 创建成功！")
    txt.close()
except Exception as e:
    print(f" TextClip 创建失败: {e}")
    print("尝试禁用字幕继续...")

# 重新运行主程序 - 使用正确的类名
from run_interactive import InteractiveAgent  # 正确的类名
print("重新运行视频合成...")
agent = InteractiveAgent("configs/mm_story_agent.yaml")
agent.run()
